package com.lijie.homework2;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class ShowActivity extends AppCompatActivity {
    private ListView lv;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show);
        lv = (ListView)findViewById(R.id.lv);
        Intent intent = getIntent();
        ArrayList plist = (ArrayList)intent.getSerializableExtra("list");
        if(plist==null){
            Log.i("hahah","..............asdad000000000000000");
        }
        Log.i("hahah","..............asdad"+plist.size());
        ArrayList list = new ArrayList();
        for(int i=0;i<plist.size();i++){
           User user = (User)plist.get(i);
            String info = "姓名："+user.getName()+"  电话"+user.getPhone();
            list.add(info);
        }
        ArrayAdapter aa = new ArrayAdapter(this,R.layout.support_simple_spinner_dropdown_item,list);
        lv.setAdapter(aa);
    }
}
